<%@ page import="java.util.List" %>
<%@ page import="domain.User" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/10/19
  Time: 8:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>

</head>
<body>
<h1 align="center">商品展示</h1>
<table align="center" border="1"  cellpadding="0" width="600px" id="product">
    <tr>
        <td width="10%">序号</td>
        <td width="40%">商品名称</td>
        <td width="25%">价格</td>
        <td width="25%">操作</td>
    </tr>

    <c:forEach var="p" items="${list}"  >
       <c:choose>
           <c:when test="${p.pid%2==0}">
                   <tr style="background-color: red">
                       <td>${p.pid}</td>
                       <td>${p.pname}</td>
                       <td>${p["market_price"]}</td>
                       <td><a href="${pageContext.request.contextPath}/AddCartServlet?pid=${p.pid}">点击购买</a></td>
                   </tr>
           </c:when>
           <c:otherwise>
                   <tr>
                       <td>${p.pid}</td>
                       <td>${p.pname}</td>
                       <td>${p["market_price"]}</td>
                       <td><a href="${pageContext.request.contextPath}/AddCartServlet?pid=${p.pid}">点击购买</a></td>
                   </tr>
           </c:otherwise>
    </c:choose>
    </c:forEach>

</table>
</body>
</html>
